<?php
/**@var \Weline\Framework\View\Template $this */
/**@var \Weline\Backend\Block\ThemeConfig $themeConfig */
$themeConfig = \Weline\Framework\Manager\ObjectManager::getInstance(\Weline\Backend\Block\ThemeConfig::class);
?>
<!DOCTYPE html>
<!--
 *@Author       秋枫雁飞
 *@Email        aiweline@qq.com
 *@Forum        https://bbs.aiweline.com
 *@DESC         后台共用头部
-->
<html lang='en' <?= ('rtl' === $themeConfig->getThemeModel()) ? " dir=\"rtl\"" : '' ?>>
<head>
    @template(Weline_Admin::common/head.phtml)
    <title><?= __('Aliyun动态域名解析') ?></title>
</head>

<body <?= $themeConfig->getLayouts() ?? ''; ?>>

<!--页头工具条 开始-->
@template(Weline_Admin::common/page/loading.phtml)
<!--页头工具条 结束-->

<!-- <body data-layout="horizontal" data-topbar="dark"> -->

<!-- 开始 页面 -->
<div id="layout-wrapper">


    <!--页头工具条 开始-->
    <w:block class='Weline\Admin\Block\Backend\Page\Topbar'/>
    <!--页头工具条 结束-->

    <!-- ========== Topnav Start ========== -->
    <!--页头菜单栏 开始-->
    <w:block class='Weline\Admin\Block\Backend\Page\Topnav'/>
    <!--页头菜单栏 结束-->

    <!-- ========== Left Sidebar Start ========== -->
    <!--左侧菜单栏 开始-->
    @template(Weline_Admin::common/left-sidebar.phtml)
    <!--左侧菜单栏 结束-->


    <!-- ============================================================== -->
    <!-- Start right Content here -->
    <!-- ============================================================== -->
    <div class="main-content">

        <div class='page-content'>
            <div class='container-fluid'>
                <!-- start page title -->
                <div class='row'>
                    <div class='col-12'>
                        <div class='page-title-box d-sm-flex align-items-center justify-content-between'>
                            <h4 class='mb-sm-0'>
                                <lang>Aliyun</lang>
                                >
                                <lang>Ddns</lang>
                                >
                                <lang>配置</lang>
                            </h4>

                            <div class='page-title-right'>
                                <ol class='breadcrumb m-0'>
                                    <li class='breadcrumb-item'><a href='javascript: void(0);'>
                                            <lang>Aliyun</lang>
                                        </a></li>
                                    <li class='breadcrumb-item'>
                                        <a href="@backend-url('*/backend/ddnslist')">
                                            <lang>Ddns</lang>
                                        </a>
                                    </li>
                                    <li class='breadcrumb-item active'>
                                        <lang>配置</lang>
                                    </li>
                                </ol>
                            </div>

                        </div>
                    </div>
                </div>
                <!-- end page title -->
                <!-- start page message -->
                <div class='row'>
                    <template>Weline_Component::message.phtml</template>
                </div> <!-- end message -->
                <div class='row'>
                    <div class='col-12'>
                        <div class='card'>
                            <div class='card-body'>
                                <h4 class='card-title'>
                                    <lang>阿里云账号授权信息</lang>
                                </h4>
                                <p class='card-title-desc'>
                                    <lang>填写来自阿里云账号的授权信息：accessKeyId和accessSecret。</lang>
                                </p>
                                <form class='needs-validation' novalidate='' action="@backend-url('*/backend/config')" method="post">
                                    <!--基础信息-->
                                    <div class='row'>
                                        <div class='col-md-3'>
                                            <div class='mb-3'>
                                                <label class='form-label' for='accessKeyId'>
                                                    accessKeyId
                                                </label>
                                                <input type='text' class='form-control' maxlength='60' data-parsley-minlength='3'
                                                       id='accessKeyId' placeholder='accessKeyId'
                                                       value='{{accessKeyId}}' name="accessKeyId"
                                                       required=''>
                                                <div class='valid-feedback'>
                                                    <lang>填写正确！</lang>
                                                </div>
                                            </div>
                                        </div>
                                        <div class='col-md-3'>
                                            <div class='mb-3'>
                                                <label class='form-label' for='accessSecret'>
                                                    accessSecret
                                                </label>
                                                <input type='text' class='form-control' maxlength='128' data-parsley-minlength='3'
                                                       id='accessSecret' placeholder='accessSecret'
                                                       value='{{accessSecret}}' name="accessSecret"
                                                       required=''>
                                                <div class='valid-feedback'>
                                                    <lang>填写正确！</lang>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <button class='btn btn-primary' type='submit'>
                                        <lang>保存</lang>
                                    </button>
                                </form>
                            </div>
                        </div>
                    </div> <!-- end col -->
                </div> <!-- end row -->
            </div> <!-- container-fluid -->
        </div>
        <!-- End Page-content -->

        <footer class="footer">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-6">
                        <script>document.write(new Date().getFullYear())</script>
                        © Weline.
                    </div>
                    <div class="col-sm-6">
                        <div class="text-sm-end d-none d-sm-block">
                            Crafted with <i class="mdi mdi-heart text-danger"></i> By <a
                                href="https://www.aiweline.com/">秋枫雁飞(aiweline)</a>
                        </div>
                    </div>
                </div>
            </div>
        </footer>

    </div>
    <!-- end main content-->
</div>
<!-- END layout-wrapper -->
<!--右边栏-->
@template(Weline_Admin::common/right-sidebar.phtml)
<script>
    let validationEntity = $('#validationEntity')
    validationEntity.change(function () {
        let selectedOption = $(this).find(':selected').val();
        renderAttributeSet(selectedOption)
    });
    // 初始化
    let initSelected = validationEntity.find(':selected').val()
    let validationSet = $('#validationSet')
    renderAttributeSet(initSelected)

    function renderAttributeSet(entity_code) {
        $.get("@backend-url('*/backend/attribute/set/apiSearch')?entity_code=" + entity_code).then((res) => {
            let items = res['items']
            validationSet.empty()
            for (const itemsKey in items) {
                let item = items[itemsKey]
                let selected = '';
                if (validationSet.attr('data-selected') === item.code) {
                    selected = 'selected';
                }
                validationSet.append("<option value='" + item.code + "' " + selected + ">" + window.lang(item.name) + "</option>")
            }
        })
    }
</script>
@template(Weline_Admin::common/footer.phtml)
</body>
</html>
